/* eslint-disable no-case-declarations */
<template>
  <div>
    <base-dialog
      class="dialog_box"
      width="80%"
      :visible.sync="dialog.visible"
      :title="dialog.title"
      :loading="dialog.loading"
      :disabled="dialog.disabled"
      :show-default-footer="false"
      @updateData="updateData"
      @open="beforeOpenDialog">
      <el-form
        ref="dataForm"
        :model="dialog.form"
        :rules="dialog.rules"
        :disabled="dialog.disabled"
        label-width="100px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="计划年份" prop="planYear">
              <el-date-picker
                v-model="dialog.form.planYear"
                type="year"
                placeholder="选择年份" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="6C类型" prop="cType">
              <el-select v-model="dialog.form.cType" class="phm-form" clearable placeholder="请选择6C类型">
                <el-option
                  v-for="item in deviceType"
                  :key="item.itemValue"
                  :label="item.itemName"
                  :value="item.itemValue" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="编制人" prop="preparedBy">
              <el-input v-model="dialog.form.preparedBy" type="text" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div v-if="dialog.isShowMonthPlan" style="width: 100%">
        <el-form
          :model="dialog.detailForm"
          :disabled="dialog.disabled">
          <div id="gt" style="width: 49%;float: left;">
            <p style="margin-left: 3%;">高铁</p>
            <el-card v-for="month in 12" class="box-card">
              <div slot="header" class="clearfix" align="center">
                <el-button type="text" :send-data="toChildChecked" style="color: #FFFFFF" @click="transferDialog('GT',month)">{{ month }}月<i class="el-icon-edit-outline el-icon--right" /></el-button>
              </div>
              <div :id="'GT-'+month" class="text item" style="height: 80px;overflow:auto;" />
            </el-card>
          </div>
          <div id="pt" style="width: 49%;float: left;margin-left: 2%;">
            <p style="margin-left: 3%;">普铁</p>
            <el-card v-for="month in 12" class="box-card">
              <div slot="header" class="clearfix" align="center">
                <el-button type="text" :send-data="toChildChecked" style="color: #FFFFFF" @click="transferDialog('PT',month)">{{ month }}月<i class="el-icon-edit-outline el-icon--right" /></el-button>
              </div>
              <div :id="'PT-'+month" class="text item" style="height: 80px;overflow:auto;" />
            </el-card>
          </div>
        </el-form>
      </div>
      <div align="center">
        <span slot="footer" class="dialog-footer">
          <el-button v-if="dialog.isYearPlan" size="medium" icon="el-icon-check" style="width: 100px;height: 35px;background-color: #48B94D;color: #FFFFFF;" @click="updateData">保存</el-button>
          <el-button v-if="dialog.isMonthPlan" size="medium" icon="el-icon-check" style="width: 100px;height: 35px;background-color: #48B94D;color: #FFFFFF;" @click="saveYearlyPlanDetail">保存</el-button>
         <el-button v-if="dialog.isAllPlan" size="medium" icon="el-icon-check" style="width: 100px;height: 35px;background-color: #48B94D;color: #FFFFFF;" @click="updateAllData">保存</el-button>
          <el-button size="medium" icon="el-icon-close" style="width: 100px;height: 35px;background-color: #E05252;color: #FFFFFF;" @click="dialog.visible = false">关闭</el-button>
        </span>
      </div>
    </base-dialog>

    <!-- 线路选择弹框 -->
    <base-dialog
      class="dialog_box"
      width="60%"
      :show-default-footer="false"
      :visible.sync="dialogLine.visible"
      :title="dialogLine.title"
      :loading="dialogLine.loading"
      :disabled="dialogLine.disabled">
      <div align="center">
        <cus-transfer
          v-model="value"
          :exe-num="exeNum"
          :data="data"
          :titles="titles"
          :panel-width="300"
          :is-show-left-input="false"
          :is-show-right-input="true"
          @exeNum2="getExeNum" />
      </div>
      <div align="center" style="margin-top: 40px;">
        <span slot="footer" class="dialog-footer">
          <el-button size="medium" icon="el-icon-check" style="width: 100px;height: 35px;background-color: #48B94D;color: #FFFFFF;" @click="saveLine">保存</el-button>
          <el-button size="medium" icon="el-icon-close" style="width: 100px;height: 35px;background-color: #E05252;color: #FFFFFF;" @click="dialogLine.visible = false">关闭</el-button>
        </span>
      </div>
    </base-dialog>

  </div>
</template>
<script>
import { getLineList } from '@/api/platform'
import CusTransfer from './main'
import {
  addOrEditDataBatch,
  getDetailByPlanYearId
} from '@/api/cms/Inspection-management/Inspection-plan-management/YearlyPlanDetail'
import { getListByTypeCode } from '@/api/cms/basic'
// import { getDeptAll } from '@/api/cms/basic'
export default {
  components: { CusTransfer },
  props: {
    dialog: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      toChildChecked: [],
      railType_Tag: '',
      month_Tag: '',
      yearlyPlanDetail_Tag: {
        planYearId: '',
        gt: {
          checked1: [],
          checked2: [],
          checked3: [],
          checked4: [],
          checked5: [],
          checked6: [],
          checked7: [],
          checked8: [],
          checked9: [],
          checked10: [],
          checked11: [],
          checked12: []
        },
        pt: {
          checked1: [],
          checked2: [],
          checked3: [],
          checked4: [],
          checked5: [],
          checked6: [],
          checked7: [],
          checked8: [],
          checked9: [],
          checked10: [],
          checked11: [],
          checked12: []
        }
      },
      lineAll: [],
      titles: ['未选路线', '已选路线'],
      data: [],
      value: [],
      exeNum: [],
      deviceType: [], // 装置类型
      // 添加线路弹框
      dialogLine: {
        title: '编制',
        visible: false,
        disabled: false,
        loading: false,
        railType: '',
        month: '',
        dataList: {
          lineList: []
        }
      }
    }
  },
  watch: {
    'dialog.visible'() {
      if (this.dialog.visible) {
        this.getList()
      }
    }
  },
  methods: {
    getExeNum(childData) {
      childData.forEach(item => {
        if (this.railType_Tag === 'GT') {
          switch (this.month_Tag) {
            case 1 :
              // eslint-disable-next-line no-case-declarations
              let tag1 = false
              this.yearlyPlanDetail_Tag.gt.checked1.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag1 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag1) {
                this.yearlyPlanDetail_Tag.gt.checked1.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 2 :
              // eslint-disable-next-line no-case-declarations
              let tag2 = false
              this.yearlyPlanDetail_Tag.gt.checked2.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag2 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag2) {
                this.yearlyPlanDetail_Tag.gt.checked2.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 3 :
              // eslint-disable-next-line no-case-declarations
              let tag3 = false
              this.yearlyPlanDetail_Tag.gt.checked3.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag3 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag3) {
                this.yearlyPlanDetail_Tag.gt.checked3.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 4 :
              // eslint-disable-next-line no-case-declarations
              let tag4 = false
              this.yearlyPlanDetail_Tag.gt.checked4.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag4 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag4) {
                this.yearlyPlanDetail_Tag.gt.checked4.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 5 :
              // eslint-disable-next-line no-case-declarations
              let tag5 = false
              this.yearlyPlanDetail_Tag.gt.checked5.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag5 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag5) {
                this.yearlyPlanDetail_Tag.gt.checked5.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 6 :
              // eslint-disable-next-line no-case-declarations
              let tag6 = false
              this.yearlyPlanDetail_Tag.gt.checked6.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag6 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag6) {
                this.yearlyPlanDetail_Tag.gt.checked6.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 7 :
              // eslint-disable-next-line no-case-declarations
              let tag7 = false
              this.yearlyPlanDetail_Tag.gt.checked7.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag7 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag7) {
                this.yearlyPlanDetail_Tag.gt.checked7.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 8 :
              // eslint-disable-next-line no-case-declarations
              let tag8 = false
              this.yearlyPlanDetail_Tag.gt.checked8.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag8 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag8) {
                this.yearlyPlanDetail_Tag.gt.checked8.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 9 :
              // eslint-disable-next-line no-case-declarations
              let tag9 = false
              this.yearlyPlanDetail_Tag.gt.checked9.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag9 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag9) {
                this.yearlyPlanDetail_Tag.gt.checked9.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 10 :
              // eslint-disable-next-line no-case-declarations
              let tag10 = false
              this.yearlyPlanDetail_Tag.gt.checked10.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag10 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag10) {
                this.yearlyPlanDetail_Tag.gt.checked10.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 11 :
              // eslint-disable-next-line no-case-declarations
              let tag11 = false
              this.yearlyPlanDetail_Tag.gt.checked11.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag11 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag11) {
                this.yearlyPlanDetail_Tag.gt.checked11.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 12 :
              // eslint-disable-next-line no-case-declarations
              let tag12 = false
              this.yearlyPlanDetail_Tag.gt.checked12.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag12 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag12) {
                this.yearlyPlanDetail_Tag.gt.checked12.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
          }
        } else {
          switch (this.month_Tag) {
            case 1 :
              // eslint-disable-next-line no-case-declarations
              let tag1 = false
              this.yearlyPlanDetail_Tag.pt.checked1.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag1 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag1) {
                this.yearlyPlanDetail_Tag.pt.checked1.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 2 :
              // eslint-disable-next-line no-case-declarations
              let tag2 = false
              this.yearlyPlanDetail_Tag.pt.checked2.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag2 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag2) {
                this.yearlyPlanDetail_Tag.pt.checked2.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 3 :
              // eslint-disable-next-line no-case-declarations
              let tag3 = false
              this.yearlyPlanDetail_Tag.pt.checked3.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag3 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag3) {
                this.yearlyPlanDetail_Tag.pt.checked3.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 4 :
              // eslint-disable-next-line no-case-declarations
              let tag4 = false
              this.yearlyPlanDetail_Tag.pt.checked4.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag4 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag4) {
                this.yearlyPlanDetail_Tag.pt.checked4.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 5 :
              // eslint-disable-next-line no-case-declarations
              let tag5 = false
              this.yearlyPlanDetail_Tag.pt.checked5.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag5 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag5) {
                this.yearlyPlanDetail_Tag.pt.checked5.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 6 :
              // eslint-disable-next-line no-case-declarations
              let tag6 = false
              this.yearlyPlanDetail_Tag.pt.checked6.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag6 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag6) {
                this.yearlyPlanDetail_Tag.pt.checked6.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 7 :
              // eslint-disable-next-line no-case-declarations
              let tag7 = false
              this.yearlyPlanDetail_Tag.pt.checked7.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag7 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag7) {
                this.yearlyPlanDetail_Tag.pt.checked7.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 8 :
              // eslint-disable-next-line no-case-declarations
              let tag8 = false
              this.yearlyPlanDetail_Tag.pt.checked8.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag8 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag8) {
                this.yearlyPlanDetail_Tag.pt.checked8.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 9 :
              // eslint-disable-next-line no-case-declarations
              let tag9 = false
              this.yearlyPlanDetail_Tag.pt.checked9.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag9 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag9) {
                this.yearlyPlanDetail_Tag.pt.checked9.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 10 :
              // eslint-disable-next-line no-case-declarations
              let tag10 = false
              this.yearlyPlanDetail_Tag.pt.checked10.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag10 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag10) {
                this.yearlyPlanDetail_Tag.pt.checked10.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 11 :
              // eslint-disable-next-line no-case-declarations
              let tag11 = false
              this.yearlyPlanDetail_Tag.pt.checked11.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag11 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag11) {
                this.yearlyPlanDetail_Tag.pt.checked11.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
            case 12 :
              // eslint-disable-next-line no-case-declarations
              let tag12 = false
              this.yearlyPlanDetail_Tag.pt.checked12.forEach(itemItem => {
                if (itemItem.lineId === item.key) {
                  tag12 = true
                  itemItem.exeNum = item.NumberProp
                }
              })
              if (!tag12) {
                this.yearlyPlanDetail_Tag.pt.checked12.push({ lineId: item.key, exeNum: item.NumberProp })
              }
              break // 停止执行，跳出switch
          }
        }
      })
    },
    saveYearlyPlanDetail() {
      this.dialog.yearlyPlanDetail['planYearId'] = this.dialog.form.id
      addOrEditDataBatch(this.dialog.yearlyPlanDetail)
        .then((response) => {
          // console.log(response)
          this.dialog.visible = false
        })
    },
    updateAllData() {
      this.updateData()
      this.saveYearlyPlanDetail()
    },
    getStr(checked) {
      let str = ''
      this.value.forEach((item, index) => {
        // eslint-disable-next-line no-unused-vars
        let tag = false
        let exeNum = 1
        let label = ''
        checked.forEach(itemItem => {
          if (item === itemItem.lineId) {
            tag = true
            exeNum = itemItem.exeNum
          }
        })
        this.data.forEach(itemItem => {
          if (item === itemItem.key) {
            label = itemItem.label
          }
        })
        if (index === 0) {
          str = label + ' x ' + exeNum
        } else {
          str = str + '<br/>' + label + ' x ' + exeNum
        }
      })
      return str
    },
    saveLine() {
      let str = ''
      if (this.dialogLine.railType === 'GT') {
        switch (this.dialogLine.month) {
          case 1 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked1)
            this.dialog.yearlyPlanDetail.gt.value1 = this.value
            // eslint-disable-next-line no-case-declarations
            const result1 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked1.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result1.push(itemItem)
                }
              })
              if (!tag) {
                result1.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked1 = result1
            break // 停止执行，跳出switch
          case 2 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked2)
            this.dialog.yearlyPlanDetail.gt.value2 = this.value
            // eslint-disable-next-line no-case-declarations
            const result2 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked2.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result2.push(itemItem)
                }
              })
              if (!tag) {
                result2.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked2 = result2
            break // 停止执行，跳出switch
          case 3 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked3)
            this.dialog.yearlyPlanDetail.gt.value3 = this.value
            // eslint-disable-next-line no-case-declarations
            const result3 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked3.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result3.push(itemItem)
                }
              })
              if (!tag) {
                result3.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked3 = result3
            break // 停止执行，跳出switch
          case 4 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked4)
            this.dialog.yearlyPlanDetail.gt.value4 = this.value
            // eslint-disable-next-line no-case-declarations
            const result4 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked4.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result4.push(itemItem)
                }
              })
              if (!tag) {
                result4.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked4 = result4
            break // 停止执行，跳出switch
          case 5 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked5)
            this.dialog.yearlyPlanDetail.gt.value5 = this.value
            // eslint-disable-next-line no-case-declarations
            const result5 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked5.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result5.push(itemItem)
                }
              })
              if (!tag) {
                result5.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked5 = result5
            break // 停止执行，跳出switch
          case 6 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked6)
            this.dialog.yearlyPlanDetail.gt.value6 = this.value
            // eslint-disable-next-line no-case-declarations
            const result6 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked6.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result6.push(itemItem)
                }
              })
              if (!tag) {
                result6.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked6 = result6
            break // 停止执行，跳出switch
          case 7 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked7)
            this.dialog.yearlyPlanDetail.gt.value7 = this.value
            // eslint-disable-next-line no-case-declarations
            const result7 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked7.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result7.push(itemItem)
                }
              })
              if (!tag) {
                result7.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked7 = result7
            break // 停止执行，跳出switch
          case 8 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked8)
            this.dialog.yearlyPlanDetail.gt.value8 = this.value
            // eslint-disable-next-line no-case-declarations
            const result8 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked8.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result8.push(itemItem)
                }
              })
              if (!tag) {
                result8.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked8 = result8
            break // 停止执行，跳出switch
          case 9 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked9)
            this.dialog.yearlyPlanDetail.gt.value9 = this.value
            // eslint-disable-next-line no-case-declarations
            const result9 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked9.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result9.push(itemItem)
                }
              })
              if (!tag) {
                result9.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked9 = result9
            break // 停止执行，跳出switch
          case 10 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked10)
            this.dialog.yearlyPlanDetail.gt.value10 = this.value
            // eslint-disable-next-line no-case-declarations
            const result10 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked10.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result10.push(itemItem)
                }
              })
              if (!tag) {
                result10.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked10 = result10
            break // 停止执行，跳出switch
          case 11 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked11)
            this.dialog.yearlyPlanDetail.gt.value11 = this.value
            // eslint-disable-next-line no-case-declarations
            const result11 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked11.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result11.push(itemItem)
                }
              })
              if (!tag) {
                result11.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked11 = result11
            break // 停止执行，跳出switch
          case 12 :
            str = this.getStr(this.yearlyPlanDetail_Tag.gt.checked12)
            this.dialog.yearlyPlanDetail.gt.value12 = this.value
            // eslint-disable-next-line no-case-declarations
            const result12 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.gt.checked12.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result12.push(itemItem)
                }
              })
              if (!tag) {
                result12.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.gt.checked12 = result12
            break // 停止执行，跳出switch
        }
      } else {
        switch (this.dialogLine.month) {
          case 1 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked1)
            this.dialog.yearlyPlanDetail.pt.value1 = this.value
            // eslint-disable-next-line no-case-declarations
            const result1 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked1.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result1.push(itemItem)
                }
              })
              if (!tag) {
                result1.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked1 = result1
            break // 停止执行，跳出switch
          case 2 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked2)
            this.dialog.yearlyPlanDetail.pt.value2 = this.value
            // eslint-disable-next-line no-case-declarations
            const result2 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked2.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result2.push(itemItem)
                }
              })
              if (!tag) {
                result2.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked2 = result2
            break // 停止执行，跳出switch
          case 3 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked3)
            this.dialog.yearlyPlanDetail.pt.value3 = this.value
            // eslint-disable-next-line no-case-declarations
            const result3 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked3.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result3.push(itemItem)
                }
              })
              if (!tag) {
                result3.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked3 = result3
            break // 停止执行，跳出switch
          case 4 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked4)
            this.dialog.yearlyPlanDetail.pt.value4 = this.value
            // eslint-disable-next-line no-case-declarations
            const result4 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked4.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result4.push(itemItem)
                }
              })
              if (!tag) {
                result4.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked4 = result4
            break // 停止执行，跳出switch
          case 5 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked5)
            this.dialog.yearlyPlanDetail.pt.value5 = this.value
            // eslint-disable-next-line no-case-declarations
            const result5 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked5.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result5.push(itemItem)
                }
              })
              if (!tag) {
                result5.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked5 = result5
            break // 停止执行，跳出switch
          case 6 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked6)
            this.dialog.yearlyPlanDetail.pt.value6 = this.value
            // eslint-disable-next-line no-case-declarations
            const result6 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked6.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result6.push(itemItem)
                }
              })
              if (!tag) {
                result6.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked6 = result6
            break // 停止执行，跳出switch
          case 7 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked7)
            this.dialog.yearlyPlanDetail.pt.value7 = this.value
            // eslint-disable-next-line no-case-declarations
            const result7 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked7.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result7.push(itemItem)
                }
              })
              if (!tag) {
                result7.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked7 = result7
            break // 停止执行，跳出switch
          case 8 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked8)
            this.dialog.yearlyPlanDetail.pt.value8 = this.value
            // eslint-disable-next-line no-case-declarations
            const result8 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked8.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result8.push(itemItem)
                }
              })
              if (!tag) {
                result8.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked8 = result8
            break // 停止执行，跳出switch
          case 9 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked9)
            this.dialog.yearlyPlanDetail.pt.value9 = this.value
            // eslint-disable-next-line no-case-declarations
            const result9 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked9.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result9.push(itemItem)
                }
              })
              if (!tag) {
                result9.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked9 = result9
            break // 停止执行，跳出switch
          case 10 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked10)
            this.dialog.yearlyPlanDetail.pt.value10 = this.value
            // eslint-disable-next-line no-case-declarations
            const result10 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked10.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result10.push(itemItem)
                }
              })
              if (!tag) {
                result10.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked10 = result10
            break // 停止执行，跳出switch
          case 11 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked11)
            this.dialog.yearlyPlanDetail.pt.value11 = this.value
            // eslint-disable-next-line no-case-declarations
            const result11 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked11.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result11.push(itemItem)
                }
              })
              if (!tag) {
                result11.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked11 = result11
            break // 停止执行，跳出switch
          case 12 :
            str = this.getStr(this.yearlyPlanDetail_Tag.pt.checked12)
            this.dialog.yearlyPlanDetail.pt.value12 = this.value
            // eslint-disable-next-line no-case-declarations
            const result12 = []
            this.value.forEach(item => {
              let tag = false
              this.yearlyPlanDetail_Tag.pt.checked12.forEach(itemItem => {
                if (item === itemItem.lineId) {
                  tag = true
                  result12.push(itemItem)
                }
              })
              if (!tag) {
                result12.push({ lineId: item, exeNum: 1 })
              }
            })
            this.dialog.yearlyPlanDetail.pt.checked12 = result12
            break // 停止执行，跳出switch
        }
      }
      const divMonth = document.getElementById(this.dialogLine.railType + '-' + this.dialogLine.month)
      divMonth.innerHTML = str
      this.dialogLine.visible = false
    },
    transferDialog(railType, month) {
      this.exeNum = []
      this.railType_Tag = ''
      this.month_Tag = ''
      this.railType_Tag = railType
      this.month_Tag = month
      // 线路
      this.data = []
      if (railType === 'GT') {
        switch (month) {
          case 1 :
            this.value = this.dialog.yearlyPlanDetail.gt.value1
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked1
            break // 停止执行，跳出switch
          case 2 :
            this.value = this.dialog.yearlyPlanDetail.gt.value2
            this.exeNum.push = this.dialog.yearlyPlanDetail.gt.checked2
            break // 停止执行，跳出switch
          case 3 :
            this.value = this.dialog.yearlyPlanDetail.gt.value3
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked3
            break // 停止执行，跳出switch
          case 4 :
            this.value = this.dialog.yearlyPlanDetail.gt.value4
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked4
            break // 停止执行，跳出switch
          case 5 :
            this.value = this.dialog.yearlyPlanDetail.gt.value5
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked5
            break // 停止执行，跳出switch
          case 6 :
            this.value = this.dialog.yearlyPlanDetail.gt.value6
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked6
            break // 停止执行，跳出switch
          case 7 :
            this.value = this.dialog.yearlyPlanDetail.gt.value7
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked7
            break // 停止执行，跳出switch
          case 8 :
            this.value = this.dialog.yearlyPlanDetail.gt.value8
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked8
            break // 停止执行，跳出switch
          case 9 :
            this.value = this.dialog.yearlyPlanDetail.gt.value9
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked9
            break // 停止执行，跳出switch
          case 10 :
            this.value = this.dialog.yearlyPlanDetail.gt.value10
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked10
            break // 停止执行，跳出switch
          case 11 :
            this.value = this.dialog.yearlyPlanDetail.gt.value11
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked11
            break // 停止执行，跳出switch
          case 12 :
            this.value = this.dialog.yearlyPlanDetail.gt.value12
            this.exeNum = this.dialog.yearlyPlanDetail.gt.checked12
            break // 停止执行，跳出switch
          default : // 上述条件都不满足时，默认执行的代码
            console.log(this.dialogLine.month)
        }
      } else {
        switch (month) {
          case 1 :
            this.value = this.dialog.yearlyPlanDetail.pt.value1
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked1
            break // 停止执行，跳出switch
          case 2 :
            this.value = this.dialog.yearlyPlanDetail.pt.value2
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked2
            break // 停止执行，跳出switch
          case 3 :
            this.value = this.dialog.yearlyPlanDetail.pt.value3
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked3
            break // 停止执行，跳出switch
          case 4 :
            this.value = this.dialog.yearlyPlanDetail.pt.value4
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked4
            break // 停止执行，跳出switch
          case 5 :
            this.value = this.dialog.yearlyPlanDetail.pt.value5
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked5
            break // 停止执行，跳出switch
          case 6 :
            this.value = this.dialog.yearlyPlanDetail.pt.value6
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked6
            break // 停止执行，跳出switch
          case 7 :
            this.value = this.dialog.yearlyPlanDetail.pt.value7
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked7
            break // 停止执行，跳出switch
          case 8 :
            this.value = this.dialog.yearlyPlanDetail.pt.value8
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked8
            break // 停止执行，跳出switch
          case 9 :
            this.value = this.dialog.yearlyPlanDetail.pt.value9
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked9
            break // 停止执行，跳出switch
          case 10 :
            this.value = this.dialog.yearlyPlanDetail.pt.value10
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked10
            break // 停止执行，跳出switch
          case 11 :
            this.value = this.dialog.yearlyPlanDetail.pt.value11
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked11
            break // 停止执行，跳出switch
          case 12 :
            this.value = this.dialog.yearlyPlanDetail.pt.value12
            this.exeNum = this.dialog.yearlyPlanDetail.pt.checked12
            break // 停止执行，跳出switch
          default : // 上述条件都不满足时，默认执行的代码
            console.log(this.dialogLine.month)
        }
      }
      getLineList({ railType: railType }).then((response) => {
        response.data.forEach(item => {
          this.data.push({
            key: item.seclineId,
            label: item.seclineName,
            MinNumberProp: 1,
            NumberProp: 1
          })
        })
        // console.log(this.data)
      })
      // this.currentRow = [row]
      const dialogLine = {
        title: '编制',
        type: 'add',
        visible: true,
        disabled: false,
        loading: false,
        railType: railType,
        month: month
        // form: JSON.parse(JSON.stringify(row))
      }
      this.dialogLine = Object.assign(this.dialogLine, dialogLine)
    },
    // 获取下拉数据、字典
    getList() {
      getListByTypeCode({ typeCode: 'JCJCTYPE' }).then(response => {
        this.deviceType = response.data
      })
    },
    // 回调方法
    updateData() {
      this.$refs.dataForm.validate((valid) => {
        if (valid) {
          this.dialog.loading = true
          this.$emit('updateData', this.dialog.form)
        }
      })
    },
    // 初始化
    beforeOpenDialog() {
      this.$nextTick(() => {
        if (this.dialog.type === 'edit') {
          this.dialog.isAllPlan = true
        } else {
          this.dialog.isAllPlan = false
        }
        this.$refs.dataForm.clearValidate()
        this.clearInnerHTML()
        getLineList().then((response) => {
          this.lineAll = response.data
          if (this.lineAll.length > 0 && this.dialog.type === 'edit') {
            getDetailByPlanYearId({ 'planYearId': this.dialog.form.id }).then((response) => {
              response.data.forEach(item => {
                this.innerHTMLDiv(item)
              })
            })
          }
        })
      })
    },
    innerHTMLDiv(param) {
      let lineName = ''
      if (this.lineAll.length > 0) {
        this.lineAll.forEach(item => {
          if (item.seclineId === param.lineId) {
            lineName = item.seclineName
          }
        })
        const str = lineName + ' x ' + param.executeNum + '<br/>'
        const divMonth = document.getElementById(param.railwayType + '-' + param.month)
        divMonth.innerHTML = divMonth.innerHTML + str
      }
    },
    clearInnerHTML() {
      for (let i = 1; i < 13; i++) {
        document.getElementById('GT-' + i).innerHTML = ''
        document.getElementById('PT-' + i).innerHTML = ''
      }
    }
  }
}
</script>
<style lang="scss">
.text {
  font-size: 12px;
}

.item {
  //margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both
}

.box-card {
  width: 31%;
  float: left;
  margin-left: 1%;
  margin-right: 1%;
  margin-top: 10px;
  margin-bottom: 5px;
}
.el-card  .el-card__header {
  height: 50px;
  padding: 8px 20px;
  border-bottom: 1px solid #EBEEF5;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  font-size: 16px;
  background-color: #0000FF;
}
//.el-card  .el-card__body {
//  padding: 6px;
//}
//.el-transfer-panel .el-transfer-panel__header {
//  //margin-left: -100px;
//  padding-left: -100px;
//}
#transfer-panel-left{
  width: 200px;
}
#transfer-panel-right{
  width: 320px;
}
.el-input-number{
  margin-left: 20px;
}
.el-transfer-panel__item{
  height: 35px;
  //margin-bottom: 5px;
}
.el-card__body{
  height: 70px;
}
</style>
